﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    [ObjectEvent]
    public class Features_ThroughComponentEvent : ObjectEvent<Features_ThroughComponent>, IAwake
    {
        public void Awake()
        {
            Get().Awake();
        }
    }
    public class Features_ThroughComponent : BattleEventComponent
    {
        public override BattleEventType[] EventType { get; set; } = new BattleEventType[] { BattleEventType.TakeAttack, BattleEventType.AttackSuccess };

        public override async Task RunEvent(BattleEventType eventType, FightModel fightModel, params object[] param)
        {
            BattleCard baseCard = GetEntity<BattleCard>();
            if (eventType == BattleEventType.AttackSuccess)
            {
                baseCard.IfStand = false;
            }
            if (eventType == BattleEventType.TakeAttack)
            {
                DamageInfo damageInfo = param[0] as DamageInfo;
                damageInfo.CanBeDefence = false;
                Log.Debug($"{baseCard.CardName}的贯通效果发动了，此牌无法被防御");
            }
        }
    }
}
